<form action="{:request()->url()}" autocomplete="off" class="layui-form layui-card layui-form-pane" data-auto="true" method="post">
    <div class="layui-card-body padding-left-40">
        <div class="layui-form-item">
            <label class="layui-form-label">套餐名称</label>
            <div class="layui-input-block">
                <input class="layui-input" name="thali_name" maxlength="300" required placeholder="请输入"  value='{$vo.thali_name|default=""}'>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">邀请人方式</label>
            <div class="layui-input-block">
                <input type="radio" lay-filter="thali_type" name="thali_type" value="1" title="日卡">
                <input type="radio" lay-filter="thali_type" name="thali_type" value="2" title="月卡">
            </div>
        </div>
        <div id="day_model">
            <div class="layui-form-item">
                <label class="layui-form-label">日期数</label>
                <div class="layui-input-block">
                    <input class="layui-input" name="day_num" placeholder="请输入" value='{$vo.day_num|default=""}'>
                </div>
            </div>
        </div>
        <div id="month_model" style="display: none">
            <div class="layui-form-item">
                <label class="layui-form-label">月份数</label>
                <div class="layui-input-block">
                    <input class="layui-input" name="month_num" placeholder="请输入" value='{$vo.month_num|default=""}'>
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">基础功能金额</label>
            <div class="layui-input-block">
                <input class="layui-input" name="vip_amount" type="number" required placeholder="请输入基础套餐金额"  value='{$vo.vip_amount|default=""}'>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" data-target-tips="AI问答功能金额">AI问答功能金额</label>
            <div class="layui-input-block">
                <input class="layui-input" name="qa_amount" type="number" required placeholder="请输入AI问答功能金额"  value='{$vo.qa_amount|default=""}'>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" data-target-tips="AI训练功能金额">AI训练功能金额</label>
            <div class="layui-input-block">
                <input class="layui-input" name="train_amount" type="number" required placeholder="请输入AI训练功能金额"  value='{$vo.train_amount|default=""}'>
            </div>
        </div>
    </div>
    <div class="hr-line-dashed"></div>
    {notempty name='vo.thali_id'}<input name='thali_id' type='hidden' value='{$vo.thali_id}'>{/notempty}
    <div class="layui-form-item text-center">
        <button class="layui-btn" type='submit'>保存数据</button>
        <button class="layui-btn layui-btn-danger" data-close data-confirm="确定要取消编辑吗？" type='button'>取消编辑</button>
    </div>
    <script>
        var thali_type = '{$vo.thali_type|default=1}';
        layui.use(['form', 'layer'], function(){
            var form = layui.form
                ,layer = layui.layer;
            form.on('radio(thali_type)',function (data) {
                if(data.elem.checked){
                    if(data.value === '1'){
                        $('#day_model').show();
                        $('#month_model').hide();
                    }else{
                        $('#day_model').hide();
                        $('#month_model').show();
                    }
                }
            })
        });
        $(function () {
            if(thali_type == '1'){
                $("input[name='thali_type'][value='1']").attr("checked",true)
                $('#day_model').show();
                $('#month_model').hide();
            }else{
                $("input[name='thali_type'][value='2']").attr("checked",true)
                $('#day_model').hide();
                $('#month_model').show();
            }
        });
    </script>
</form>

